package cn.masterj.springcloud.controller;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author masterJ
 * @create 2020-04-18 13:10
 */
@RestController
public class SentielController {

    @Value("${server.port}")
    private String serverPort;

    @GetMapping("/testA")
    public String testA(){
        int i = 1 / 0;
        return "testA \t" + serverPort;
    }

    @GetMapping("/testB")
    public String testB(Long id){
        if (id != null && id < 0){
            throw new IllegalArgumentException("非法参数异常");
        }
        return "testB \t" + serverPort;
    }
}
